<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>if判断语句</title>
</head>
<body>
<script>
    document.write("定义三个变量:a=4,b=-1<br>"); 
    var a=4,b=-1;
    document.write("使用if判断a、b值大小,如果a&gt;b输出a值，如果a&lt;b,输出b值，否则输出“a=b”,输出值为："); 
    if(a>b){
       document.write(a)
    }else if(a<b) { 
        document.write(b)
    }else{
        document.write("a=b")
    }
</script>
</body>
</html>